function play() {
	//默认事件的绑定与取消
	defaultEvent('add');

	function defaultEvent(type) {
		var event = ['touchstart', 'touchmove', 'touchend'];
		if (type == 'add') {
			for (var i in event) {
				$(document).on(event[i], function (e) {
					events(e)
				}, false);
			}
		} else if (type == "remove") {
			for (var i in event) {
				$(document).unbind(event[i]);
				console.log(2);
			}
		}

		function events(e) {
			e.preventDefault();
			return false;
		}
	}
	var long = 0,
		lang = 0;
	//拖拽实现
	$('.moveBox .mover').drag({
		process: function (e) {
			long = $('.moveBox .mover').offset().left + $('.moveBox .mover').width() / 2; //拖拽物品的中心线
			lang = $('.moveBox .mover').offset().top + $('.moveBox .mover').height(); //拖拽物品的高度
		}
	});
	var arr = [
			"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1516256143190&di=a25928072b191efd362d4137548d65ed&imgtype=0&src=http%3A%2F%2Fimg1.makepolo.net%2Fimages%2Fformals%2Fmedium_img%2Fproduct%2F46%2F8%2Fmedium_fe16ea68b27838ec60478d70c7ed79aa.jpg",
			"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1516256143189&di=d7d834b6a29b71212474ff4114be732f&imgtype=0&src=http%3A%2F%2Fp1.gexing.com%2FG1%2FM00%2F81%2F13%2FrBACE1M1QtbTW3gNAAAkMWOml-8935_200x200_3.jpg%3Frecache%3D20131108",
			"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3673872817,799878421&fm=27&gp=0.jpg",
			"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2519347854,3348426275&fm=27&gp=0.jpg",
			"https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1891421243,3677258176&fm=27&gp=0.jpgS",
			"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1516256143184&di=06dba4d5dc38d7c0e74956d653cefd98&imgtype=0&src=http%3A%2F%2Fimg11.360buyimg.com%2Fn0%2Fjfs%2Ft1768%2F261%2F2096523869%2F158942%2Fecc58ed2%2F56265530N2769f8d8.jpg",
			"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1516851236&di=c4fac7129c81edd3d8c165ab2b46205c&imgtype=jpg&er=1&src=http%3A%2F%2Fimg.25pp.com%2Fuploadfile%2Fyouxi%2Fimages%2F2015%2F0603%2F20150603052628328.jpg"
		],
		score = [0, 0, 0, 0, 0, 0, 0],
		listKey = ['联想电脑', '福袋', '红包', 'list0', 'list1', 'list2', 'list3'];
	//生成东西
	function gift(top, left, index) {
		//第一步创建对象
		this.top = top;
		this.left = left;
		this.index = index;
		this.timer = null;
		//第二步创建节点
		this.Create = function () {
			//生成节点
			this.dom = document.createElement('img');
			//设置属性
			this.dom.setAttribute("index", this.index);
			this.dom.setAttribute("class", "gift");
			this.dom.setAttribute("src", arr[this.index]);
			//获取父节点
			var parent = document.querySelector(".game");
			parent.appendChild(this.dom);
			this.dom.style.left = this.left + '%';
			this.dom.style.top = this.top + '%';
		}
		//第三步动画
		this.move = function () {
				var self = this; //备份this
				this.timer = setInterval(function () {
					self.top++;

					if (self.top > 100) {
						self.die(); //消除多余节点
					}
					//判断高度符合条件后再去判断距左距离
					var nowtop = self.dom.offsetTop + self.dom.height,
						short=lang-nowtop;

					if (short>=0&&short<=40 && nowtop < lang) {//高度判断条件
						// console.log(lang+'&'+nowtop);
						self.statistics();
					}

					self.dom.style.top = self.top + '%';
				}, 25);
			},
			this.die = function () {
				clearInterval(this.timer);
				var parent = document.querySelector(".game");
				parent.removeChild(this.dom);
			},
			this.statistics = function () {
				var self = this, //备份this
					nowleft = self.dom.offsetLeft + self.dom.width / 2,//下落物品中线
					term=$(".mover .moveImg").attr("id");//判断是哪个角色
				//条件校正
				// if(term == 'r1'){
				// 	long=long-40;
				// }else if(term == 'r2'){
				// 	long=long+20;
				// }else if(term == 'r3'){
				// 	long=long-20;
				// }
				
				var lshart=long-nowleft;//物品距左差值
				var nowtop = self.dom.offsetTop + self.dom.height;
				console.log(nowtop);
				if (lshart >= -15 && lshart <= 15) {
					console.log(nowleft + "-------" + long);
					this.BGrander();
					self.die();
				}

			},
			this.BGrander = function () {
				var self = this;
				var max = Math.max.apply(null, score);
				var ide = parseInt(self.dom.getAttribute("index"));
				compute(ide);
				function compute(order) {
					score[order] += 1;
					var list = 'table .list' + ide;
					$(list).html(score[order]);
					for (var i in score) {
						if (score[i] == max) {
							console.log(i, max);
							$('table .maxCount').html(listKey[i]);
							break;
						}
					}
				}
			}
		this.Create();
		this.move();
	}

	var randerTimer = null;
	var newtimer = setInterval(function () {

		var ha = new gift(0, Math.random() * 85, parseInt(Math.random() * 7, 10));

	// 	// var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// randerTimer=setTimeout(function(){
	// 	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// },400)
	// 	// setTimeout(function(){
	// 	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// },800)
	// 	// setTimeout(function(){
	// 	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// },1200)
	// 	// setTimeout(function(){
	// 	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// },2000)
	// 	// setTimeout(function(){
	// 	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	// 	// },2400)
		console.log('执行');
		// var sc=Math.max.apply(null, score);

	}, 100000 / 60)



	//var ha = new gift(0, Math.random() * 85, parseInt(Math.random() * 7, 10));

	// function animate(time){  
	// 	var ha= new gift(0,Math.random()*85,parseInt(Math.random()*7,10));
	//    requestNextAnimationFrame(animate)//继续调用animate函数  
	// }  
	// requestNextAnimationFrame(animate)








	/*时间信息*/
	// var total=60;
	var total = 40;
	var xx = setInterval(function () {
		total--;
		$(".time").html(total);
		if (total < 0) {
			clearInterval(randerTimer);
			clearInterval(newtimer);
			clearInterval(xx);

			$(".game").hide();
			$(".result").show();
			console.log(score);
			localStorage.setItem('score', JSON.stringify(score));
			//打开默认事件
			defaultEvent('remove');
			$.post('接口', {
				'score': JSON.parse(localStorage.getItem('score'))
			});
		}
	}, 1000)
}